﻿using System;
using System.ComponentModel;

namespace Wala.Connection.Objects.Contacts
{
    public class ContactBasic : INotifyPropertyChanged
    {
        #region //-------- Private Fields ---------//
        public event PropertyChangedEventHandler PropertyChanged;

        private uint friendId;
        private string friendDisplayName;
        private string[] friendPhones;
        private long friendAvatarId;
        private long friendCoverId;
        private int gender;        

        #endregion

        #region //---------- CLR Properties ----------//

        public uint Friend_id
        {
            get { return friendId; }
            set 
            { 
                if (this.friendId != value)
                {
                    this.friendId = value;
                    OnPropertyChanged("Friend_id");
                }
            }
        }

        public string Friend_display_name
        {
            get { return friendDisplayName; }
            set 
            { 
                if(this.friendDisplayName != value)
                {
                    this.friendDisplayName = value; 
                    OnPropertyChanged("Friend_display_name");
                }
            }
        }

        public string[] Friend_phones
        {
            get { return friendPhones; }
            set 
            { 
                if(this.friendPhones != value)
                {
                    this.friendPhones = value; 
                    OnPropertyChanged("Friend_phones");
                }
            }
        }

        public long Friend_avatar_id
        {
            get { return friendAvatarId; }
            set 
            { 
                if(this.friendAvatarId!= value)
                {
                    this.friendAvatarId = value; 
                    OnPropertyChanged("Friend_avatar_id");
                }
            }
        }

        public long Friend_cover_id
        {
            get { return friendCoverId; }
            set 
            { 
                if(this.friendCoverId!=value)
                {                
                    friendCoverId = value; 
                    OnPropertyChanged("Friend_cover_id");
                }
            }
        }

        public int Gender
        {
            get { return gender; }
            set 
            { 
                if(this.gender!=value)
                {
                    gender = value; 
                    OnPropertyChanged("Gender");
                }
            }
        }
        #endregion

        #region //----------- Constructor ----------//

        public ContactBasic()
        {
            friendId = 0;
            gender = 0;
            friendAvatarId = 0;
            friendCoverId = 0;
            friendDisplayName = "";
            friendPhones = new String[] { };
        }

        public ContactBasic(uint friendId, string friendDisplayName,
                string[] friendPhones, long friendAvatarId,
                long friendCoverId, int gender)
        {
            this.friendId = friendId;
            this.gender = gender;
            this.friendAvatarId = friendAvatarId;
            this.friendCoverId = friendCoverId;
            this.friendDisplayName = friendDisplayName;
            this.friendPhones = friendPhones;
        }

        #endregion

        #region //----------- Protect Methods ----------//

        protected virtual void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
